// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
import {
    WechatPayParaInput,
    WechatPayPageInput,
    WechatPayTransactionInput,
    WechatPayRefundDomesticInput
} from '../models';
// 定义 API 路径枚举
enum Api {
    SysWechatPayGenerateParametersForJsapiPay = '/sysWechatPay/generateParametersForJsapiPay',
    SysWechatPayListRefund = '/sysWechatPay/listRefund',
    SysWechatPayPage = '/sysWechatPay/page',
    SysWechatPayPayCallBack = '/sysWechatPay/payCallBack',
    SysWechatPayPayInfoFromWechatTradeId = '/sysWechatPay/payInfoFromWechat/{tradeId}',
    SysWechatPayPayInfoTradeId = '/sysWechatPay/payInfo/{tradeId}',
    SysWechatPayPayPartnerCallBack = '/sysWechatPay/payPartnerCallBack',
    SysWechatPayPayPartnerTransaction = '/sysWechatPay/payPartnerTransaction',
    SysWechatPayPayTransactionNative = '/sysWechatPay/payTransactionNative',
    SysWechatPayPayTransaction = '/sysWechatPay/payTransaction',
    SysWechatPayRefundDomestic = '/sysWechatPay/refundDomestic',
    SysWechatPayRefundInfoFromWechatRefundId = '/sysWechatPay/refundInfoFromWechat/{refundId}',
}

// 定义 API 方法
export const apiSysWechatPayGenerateParametersForJsapiPayPost = (body?: WechatPayParaInput) =>
    request({
        url: Api.SysWechatPayGenerateParametersForJsapiPay,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayListRefundPost = (body?: string) =>
    request({
        url: Api.SysWechatPayListRefund,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayPagePost = (body?: WechatPayPageInput) =>
    request({
        url: Api.SysWechatPayPage,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayPayCallBackPost = () =>
    request({
        url: Api.SysWechatPayPayCallBack,
        method: 'post',
    });

export const apiSysWechatPayPayInfoFromWechatTradeIdGet = (tradeId: string) =>
    request({
        url: Api.SysWechatPayPayInfoFromWechatTradeId.replace('{tradeId}', tradeId),
        method: 'get',
    });

export const apiSysWechatPayPayInfoTradeIdGet = (tradeId: string) =>
    request({
        url: Api.SysWechatPayPayInfoTradeId.replace('{tradeId}', tradeId),
        method: 'get',
    });

export const apiSysWechatPayPayPartnerCallBackPost = () =>
    request({
        url: Api.SysWechatPayPayPartnerCallBack,
        method: 'post',
    });

export const apiSysWechatPayPayPartnerTransactionPost = (body?: WechatPayTransactionInput) =>
    request({
        url: Api.SysWechatPayPayPartnerTransaction,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayPayTransactionNativePost = (body?: WechatPayTransactionInput) =>
    request({
        url: Api.SysWechatPayPayTransactionNative,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayPayTransactionPost = (body?: WechatPayTransactionInput) =>
    request({
        url: Api.SysWechatPayPayTransaction,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayRefundDomesticPost = (body?: WechatPayRefundDomesticInput) =>
    request({
        url: Api.SysWechatPayRefundDomestic,
        method: 'post',
        data: body,
    });

export const apiSysWechatPayRefundInfoFromWechatRefundIdGet = (refundId: string) =>
    request({
        url: Api.SysWechatPayRefundInfoFromWechatRefundId.replace('{refundId}', refundId),
        method: 'get',
    });